package com.aidex.biz.service.impl;

import com.aidex.biz.domain.CustomerReceive;
import com.aidex.biz.mapper.CustomerReceiveMapper;
import com.aidex.biz.service.CustomerReceiveService;
import com.aidex.biz.service.CustomerXiezuService;
import com.aidex.biz.service.PushCustomerService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 我的接单Service业务层处理
 *
 * @author sean
 * @email 2074844820@qq.com
 * @date 2025-04-23
 */
@Service
@Transactional(readOnly = true)
public class CustomerReceiveServiceImpl extends BaseServiceImpl<CustomerReceiveMapper, CustomerReceive> implements CustomerReceiveService {
    private static final Logger log = LoggerFactory.getLogger(CustomerReceiveServiceImpl.class);


    @Autowired
    private CustomerShadowInfoServiceImpl customerShadowInfoService;

    @Autowired
    private CustomerXiezuService customerXiezuService;

    @Autowired
    private PushCustomerService pushCustomerService;

    /**
     * 获取单条数据
     *
     * @param customerReceive 我的接单
     * @return 我的接单
     */
    @Override
    public CustomerReceive get(CustomerReceive customerReceive) {
        CustomerReceive dto = super.get(customerReceive);
        return dto;
    }

    /**
     * 获取单条数据
     *
     * @param id 我的接单id
     * @return 我的接单
     */
    @Override
    public CustomerReceive get(String id) {
        CustomerReceive dto = super.get(id);
        return dto;
    }


    /**
     * 查询我的接单列表
     *
     * @param customerReceive 我的接单
     * @return 我的接单
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public List<CustomerReceive> findList(CustomerReceive customerReceive) {
        return super.findList(customerReceive);
    }

    /**
     * 分页查询我的接单列表
     *
     * @param customerReceive 我的接单
     * @return 我的接单
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public PageInfo<CustomerReceive> findPage(CustomerReceive customerReceive) {
        return super.findPage(customerReceive);
    }

    /**
     * 保存我的接单
     *
     * @param customerReceive
     * @return 结果
     */
    @Override
    public boolean save(CustomerReceive customerReceive) {
        return super.save(customerReceive);
    }


    /**
     * 删除我的接单信息
     *
     * @param customerReceive
     * @return 结果
     */
    @Override
    public boolean remove(CustomerReceive customerReceive) {
        return super.remove(customerReceive);
    }

    /**
     * 批量删除我的接单
     *
     * @param ids 需要删除的我的接单ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteCustomerReceiveByIds(String[] ids) {
        return mapper.deleteCustomerReceiveByIds(ids);
    }

    /**
     * 获取最大编号
     *
     * @param customerReceive 我的接单
     * @return 结果
     */
    @Override
    public int findMaxSort(CustomerReceive customerReceive) {
        return NumberUtils.nextOrder(mapper.findMaxSort(customerReceive));
    }

    @Transactional(readOnly = false)
    @Override
    public int deleteCustomerReceive(CustomerReceive customerReceive) {
        return mapper.deleteCustomerReceive(customerReceive);
    }
}
